<!DOCTYPE HTML>
<html>

	<head>
		<meta charset="utf-8">

		<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
		<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
		<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
		<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
		<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
		<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />

		<title>新增内容</title>
	</head>

	<body>
		<div class="pd-20">
			<form action="/baby/imgInfos/addImgInformation" method="post" class="form form-horizontal form-ueditor" id="form" enctype="multipart/form-data">
				<div class="row cl">
					<label class="form-label col-1"><span class="c-red">*</span>分类名称：</label>
					<div class="formControls col-2"> <span class="select-box">
				<select name="type" id="type" class="select">					
					<option value="1">赴美生子 套餐</option>
					<option value="5">孕前服务 医生</option>
					<option value="6">美国服务 产检服务</option>
					<option value="7">美国服务 办证服务</option>
					<option value="8">回国服务 回国指导</option>		
					<option value="9">回国服务 美宝教育基金</option>			
					<option value="10">回国服务 入学指南</option>
					<option value="11">海外医疗 美国试管</option>
					<option value="12">海外医疗 泰国试管</option>				
					<option value="13">美国服务 儿童摄影</option>
					<option value="14">回国服务 换证旅游</option>				
					<option value="15">我们的团队_关于圣嘉尔</option>				
					
				</select>
				</span> </div>
				</div>
				<style type="text/css">
      				#view{}
     				 #view{} .imgbox{float:left;position:relative;width:100px;height: 100px;margin-left: 10px;margin-top: 10px;
     				 padding:5px;border:solid 1px red;border-radius: 5px;;}
    			 	 #view{} .imgbox .close{border: solid 1px red;position: absolute;top: -15px;
     				 width: 20px;height: 20px; display: inherit;cursor: pointer;text-align: center;background: red;color: #fff;right: -10px;z-index: 20;border-radius: 100%;}
     				 #view{} .imgbox input{width:100%;height: 100%;z-index: 10;}
   				 </style>
				<div class="row cl">
					<label class="form-label col-1"><span class="c-red">*</span>标题内容：</label>
					<div class="formControls col-3">
						<input type="text" class="input-text" value="" placeholder="" id="" name="title">
					</div>
				</div>

				<div class="row cl">
					<label class="form-label col-1">信息内容：</label>
					<div class="formControls col-10">
						<script id="editor" type="text/plain" style="width:100%;height:300px;" name="details"></script>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-1">图片上传：</label>
					<div class="formControls col-10">
						<input type="file" name="file" id="file" datatype="*" nullmsg="请上传图片" onchange="load(this)" multiple="multiple" accept="image/*" class='myfile'></input>
						<div id="view"></div>
					</div>
				</div>
				<div class="row cl">
					<div class="col-10 col-offset-1">
						<input type="submit" class="btn btn-primary radius" name="submit" value="添 加" class="submit" />
					</div>
				</div>
			</form>
		</div>
		<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
		<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
		<script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script>
		<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.min.js"></script>
		<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.config.js"></script>
		<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.all.min.js">
		</script>
		<script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
		<script type="text/javascript" src="js/H-ui.js"></script>
		<script type="text/javascript" src="js/H-ui.admin.js"></script>
		<script src="js/jquery-form.js" type="text/javascript"></script>
		<script type="text/javascript" src="js/jquery.validate.min.js" ></script>
		<script type="text/javascript" src="js/messages_zh.min.js" ></script>
		<script type="text/javascript" src="js/rule.js" ></script>

		<script type="text/javascript">
			$(function() {
				var ue = UE.getEditor('editor');
			});

			$(document).ready(function() {

				$('#form').ajaxForm(function(data) {

					//alert(data);//弹出ajax请求后的回调结果，data回调数据  onclick="sub()"
					if (data.code == "2000") {
						alert(data.message);
						console.log(data);
						var type = $('.select').val();
						// alert(type); 
						//setCookie("username",data.data.userName);
						if (type == 1) {
							window.location.href = 'child-list.html';
						} else if (type == 2) {
							window.location.href = 'votes-list.html';
						} else if (type == 3) {
							window.location.href = 'news-list.html';
						} else if (type == 4) {
							window.location.href = 'insur-list.html';
						} else if (type == 5) {
							window.location.href = 'doctor-list.html';
						} else if (type == 6) {
							window.location.href = 'check-list.html';
						} else if (type == 7) {
							window.location.href = 'rush-list.html';
						} else if (type == 8) {
							window.location.href = 'advice-list.html';
						} else if (type == 9) {
							window.location.href = 'usa2-list.html';
						} else if (type == 10) {
							window.location.href = 'school-list.html';
						} else if (type == 11) {
							window.location.href = 'usa3-list.html';
						} else if (type == 12) {
							window.location.href = 'thai-list.html';
						} else if(type ==13){
              				window.location.href = 'baby-photo-list.html'; 
            		 	} else if(type ==14){
              				window.location.href = 'passport-travel-list.html'; 
             			} else if(type ==15){
             	              window.location.href = 'sjrl-list.html'; 
                        }
						
					} else {
						alert(data.message);
						console.log(data);
					}
				});

			});

			function load(file) {
				var num = 1;
				if (file.files) {
					$('.imgbox').remove()
					for (var i = 0; i < file.files.length; i++) {
						var reader = new FileReader();
						reader.readAsDataURL(file.files[i]);
						reader.onload = function(evt) {
							var imgbox = $('<div></div>');
							imgbox.addClass('imgbox');
							$('#view').append(imgbox);

							var imgs = $('<input type="image" />');
							imgs.attr('name', 'mum' + num);
							num++;
							imgs.appendTo(imgbox);
							imgs.attr('src', evt.target.result);
						}
					}
				}
			}
		</script>
	</body>

</html>